﻿using Heroius.Extension;
using Heroius.Extension.WPF;
using Heroius.Files;
using System.Collections.ObjectModel;

namespace AlbumDesign
{
    public class Album : ObservableEntity
    {
        public Album()
        {
            Pages = new ObservableCollection<AlbumPage>();
            Reset();
        }

        public void Reset()
        {
            Height = 325;
            Width = 260;
            DesignPageCount = 40;
            ReGenPages();
        }

        public void ReGenPages()
        {
            Pages.Clear();
            for (int i = 0; i < DesignPageCount; i++)
            {
                Pages.Add(new AlbumPage());
            }
        }

        [EntitySilo]
        public int Height
        {
            get { return h; }
            set
            {
                h = value;
                RaisePropertyChangedEvent("Height");
            }
        }
        int h;
        [EntitySilo]
        public int Width
        {
            get { return w; }
            set
            {
                w = value;
                RaisePropertyChangedEvent("Width");
            }
        }
        int w;

        [EntitySilo]
        public int DesignPageCount { get; set; }

        [PropertyPanel(Order = -1)]
        [EntitySilo]
        public ObservableCollection<AlbumPage> Pages { get; set; }
    }
}
